package com.example.school.controller.admin;

import com.example.school.dto.*;
import com.example.school.service.SemesterService;
import com.example.school.utils.common.result.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/admin/semester")
public class AdminSemesterController {

    @Autowired
    private SemesterService semesterService;

    @PostMapping("/save_semester")
    public Result saveSemester(@RequestBody AdminSemesterSaveDto dto){
        return semesterService.saveSemester(dto);
    }

    @PostMapping("/remove_semester")
    public Result removeSemester(@RequestBody AdminSemesterRemoveDto dto){
        return semesterService.removeSemester(dto);
    }

    @PostMapping("/update_get_semester")
    public Result updateGetSemester(@RequestBody AdminSemesterUpdateGetDto dto){
        return semesterService.updateGetSemester(dto);
    }

    @PostMapping("/update_semester")
    public Result updateSemester(@RequestBody AdminSemesterUpdateDto dto){
        return semesterService.updateSemester(dto);
    }

    @PostMapping("/get_semester")
    public Result getAdminSemester(@RequestBody AdminGetListDto dto) {
        return semesterService.getAdminSemester(dto);
    }

}
